import core, {Tilemap} from '../core'
import config from '../config'

core.loader.baseUrl = config.cdn

export default {
    preload() {
        core.loader
            .add('map', 'static/maps/1.json')
            .add('tilesheet', 'static/textures/tilesheet.png')
            .load(this.create.bind(this))
    },

    create() {
        this.container = new PIXI.Container()
        this.map = new Tilemap(core.loader.resources.map.data, PIXI.Texture.from('tilesheet'))
        this.container.addChild(this.map)
        core.stage.addChild(this.container)
    }
}